//
//  AppDelegate.h
//  Address-book📞
//
//  Created by Mars_ZXB on 16/8/6.
//  Copyright © 2016年 BAT3. All rights reserved.
//

#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height
#import "DetailView.h"

@implementation DetailView

#pragma mark - 重写 dealloc 


#pragma mark - 重写初始化
-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

#pragma mark - 创建子视图.
- (void)createSubViews {
    // 头像
    [self createImage];
    // 姓名
    [self createLabelOfName];
    // 性别
    [self createLabelOfGender];
    // 年龄
    [self createLabelOfAge];
    // 联系方式
    [self createLabelOfPhoneNumber];
    
}
/** 头像 */
- (void)createImage {
    
    self.picOfPerson = [[UIImageView alloc]initWithFrame:CGRectMake(10, 100, WIDTH / 3.2, (HEIGHT - 100) / 3.5)];
    self.picOfPerson.backgroundColor = [UIColor grayColor];
    [self addSubview:self.picOfPerson];
    
}
/** 姓名 */
- (void)createLabelOfName {
    self.Name = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 3.2 + 30, 100, WIDTH / 1.8, (HEIGHT - 100) / 3.5 / 4.5)];
    self.Name.layer.borderColor = [UIColor grayColor].CGColor;
    self.Name.layer.cornerRadius = 10;
    self.Name.layer.borderWidth = 1;
    [self addSubview:self.Name];
}
/** 性别 */
- (void)createLabelOfGender {
    self.Gender = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 3.2 + 30, 100 + (HEIGHT - 100) / 3.5 / 4.5 * 1.8 , WIDTH / 1.8 / 2.f - 20, (HEIGHT - 100) / 3.5 / 4.5)];
    self.Gender.layer.borderColor = [UIColor grayColor].CGColor;
    self.Gender.layer.cornerRadius = 10;
    self.Gender.layer.borderWidth = 1;
    [self addSubview:self.Gender];
}
/** 年龄 */
- (void)createLabelOfAge {
    self.Age = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 3.2 + 35 + WIDTH / 1.8 / 2.f, 100 + (HEIGHT - 100) / 3.5 / 4.5 * 1.8 , WIDTH / 1.8 / 2.f - 20, (HEIGHT - 100) / 3.5 / 4.5)];

    self.Age.layer.borderColor = [UIColor grayColor].CGColor;
    self.Age.layer.cornerRadius = 10;
    self.Age.layer.borderWidth = 1;
    [self addSubview:self.Age];
   }
/** 联系方式 */
- (void)createLabelOfPhoneNumber {
    self.PhoneNumber = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH / 3.2 + 30, 100 + (HEIGHT - 100) / 3.5 / 4.5 * 3.5, WIDTH / 1.8, (HEIGHT - 100) / 3.5 / 4.5)];

    self.PhoneNumber.layer.borderColor = [UIColor grayColor].CGColor;
    self.PhoneNumber.layer.cornerRadius = 10;
    self.PhoneNumber.layer.borderWidth = 1;
    [self addSubview:self.PhoneNumber];
}

@end
